home *** CD-ROM | disk | FTP | other *** search
- // class StructThing -- a struct thing derived from
- // class Thing.
- //
- // Version 1.01 -- 2/25/91
- //
- // Michael Kelly -- Author
- //
- #include <stdio.h>
- #include <string.h>
- #include "th_struc.hpp"
-
- void StructThing::print()
- {
- printf(
- "%d %s\n",
- ((a_struct)*this).id,
- ((a_struct)*this).key
- );
- }
-
- StructThing::operator ==(Thing &some_thing)
- {
- return ( type() == some_thing.type() ) ?
- ( strcmp( ((a_struct *)ptr())->key,
- ((a_struct *)some_thing.ptr())->key) == 0 ) : 0;
- }
-
- StructThing::operator !=(Thing &some_thing)
- {
- return !( *this == some_thing );
- }
-
- StructThing::operator < (Thing &some_thing)
- {
- return ( type() == some_thing.type() ) ?
- ( strcmp( ((a_struct *)ptr())->key,
- ((a_struct *)some_thing.ptr())->key) < 0 ) : 0;
- }
-
- StructThing::operator <=(Thing &some_thing)
- {
- return ( type() == some_thing.type() ) ?
- ( strcmp( ((a_struct *)ptr())->key,
- ((a_struct *)some_thing.ptr())->key) <= 0 ) : 0;
- }
-
- StructThing::operator > (Thing &some_thing)
- {
- return ( type() == some_thing.type() ) ?
- ( strcmp( ((a_struct *)ptr())->key,
- ((a_struct *)some_thing.ptr())->key) > 0 ) : 0;
- }
-
- StructThing::operator >=(Thing &some_thing)
- {
- return ( type() == some_thing.type() ) ?
- ( strcmp( ((a_struct *)ptr())->key,
- ((a_struct *)some_thing.ptr())->key) >= 0 ) : 0;
- }
-